package com.easyCode.dataMock.utils;

import lombok.SneakyThrows;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;

/**
 * @author 大忽悠
 * @create 2023/1/18 12:12
 */
public class ByteUtils {
    @SneakyThrows
    public static byte[] readBytes(InputStream inputStream){
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        byte[] bytes=new byte[1024];
        int len=-1;
        while((len=inputStream.read(bytes))!=-1){
               outputStream.write(bytes,0,len);
        }
        return outputStream.toByteArray();
    }
}
